Skip to content

add set_ime_editor_info#200

Merged
rib merged 3 commits intorust-mobile:mainfrom
jb55:set_ime_editor_info
Mar 2, 2026
Merged

add set_ime_editor_info#200
rib merged 3 commits intorust-mobile:mainfrom
jb55:set_ime_editor_info

Conversation

@jb55
Copy link
Contributor

@jb55 jb55 commented Jun 30, 2025

This builds on top of:

The commit in this PR is:

This adds support for GameActivity_setImeEditorInfo which is needed for setting various IME hints, such as multiline.

I'm currently using this in my egui/winit fork for mapping a new Multiline ImePurpose to ime editor options:

This ensures that the enter action button doesn't close the keyboard, it instead enters a newline.

jb55 added a commit to damus-io/notedeck that referenced this pull request Jun 30, 2025
- android-activity: rust-mobile/android-activity#200
- winit: damus-io/winit@eaff639
- egui: damus-io/egui@113922d

Signed-off-by: William Casarin <jb55@jb55.com>
jb55 added a commit to damus-io/notedeck that referenced this pull request Jun 30, 2025
support multiline ime hints
---------------------------

- android-activity: rust-mobile/android-activity#200
- winit: damus-io/winit@eaff639
- egui: damus-io/egui@113922d

And many other fixes
--------------------
Fixes: #894
Fixes: #895
Fixes: #893

Signed-off-by: William Casarin <jb55@jb55.com>
@jb55 jb55 force-pushed the set_ime_editor_info branch from 6338298 to 8db0d2b Compare August 11, 2025 15:47
@jb55 jb55 changed the title GameActivity-4.0.0: add set_ime_editor_info add set_ime_editor_info Aug 11, 2025
@nicoburns
Copy link

@jb55 What is the status of this PR? (I see it is still marked as a draft). I believe that the ability to set the action_id using this API (which isn't here, but looks like it'd be quite easy to add) + the ability to hook into the onEditorAction event (https://stackoverflow.com/questions/2004344/how-do-i-handle-imeoptions-done-button-click) are what I need in order to properly handle the "enter key" on android soft keyboard.

@jb55
Copy link
Contributor Author

jb55 commented Jan 5, 2026

we're using it in https://github.com/damus-io/notedeck, i guess I can mark it as ready.

@jb55 jb55 marked this pull request as ready for review January 5, 2026 18:37
@rib
Copy link
Member

rib commented Jan 7, 2026

Cool, thanks for looking at this. I've recently worked on exposing the editor actions via a TextAction event + fixing a panic that can come from soft keyboard visibility changes (due to APP_CMD_SOFTWARE_KB_VIS_CHANGED not being handled).

With these I've also got IME support working with winit 0.30 + egui.

Skimming this PR, I might just tweak the flags + bitmasks to be hex values since I find it a bit odd seeing these in decimal (just a pedantic personal preference I suppose)

@rib rib force-pushed the set_ime_editor_info branch from 8db0d2b to 5b7b024 Compare March 2, 2026 14:03
@rib
Copy link
Member

rib commented Mar 2, 2026

okey, sorry for the delay in getting around to look at this.

I've moved the new input types to src/input.rs (along with other existing input types) and filled out the remaining ImeOptions

ImeOptions now has a getter/setter for the action, based on the TextInputAction enum added in #216

There is also a separate InputTypeClass that lets you query the mutually-exclusive type class bits from an InputType

@rib rib force-pushed the set_ime_editor_info branch 2 times, most recently from 32d9911 to 71fa555 Compare March 2, 2026 15:22
jb55 and others added 3 commits March 2, 2026 15:54
This corresponds to the GameActivity_setImeEditorInfo function on
GameActivity. This is not supported on NativeActivity.

Signed-off-by: William Casarin <jb55@jb55.com>
This adds and documents the remaining `ImeOptions` (addressing TODO comment)

`ImeOptions` now has a getter/setter for the action, based on the
`TextInputAction` enum added in rust-mobile#216

There is also a separate `InputTypeClass` that lets you query the
mutually-exclusive type class bits from an `InputType`
Makes it possible to configure the action of the IME enter key via
`set_ime_editor_info()`
@rib rib force-pushed the set_ime_editor_info branch from 71fa555 to 5781e29 Compare March 2, 2026 15:55
@rib
Copy link
Member

rib commented Mar 2, 2026

For reference set_ime_editor_info() now also accepts an action: TextInputAction so the behaviour of the enter/action key is configurable (addressing a remaining TODO comment in the code)

@rib rib merged commit ae24c96 into rust-mobile:main Mar 2, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants